import Vue from 'vue'
import VueRouter from 'vue-router'
/* Layout */
import Layout from '@/components/layout/Layout.vue'

Vue.use(VueRouter)

export const constantRoutes = [
  {
    path: '/',
    component: Layout,
    redirect: '/',
    children: [{
      path: '',
      name: 'layout',
      component: () => import ('@/views/layout.vue'),
      meta: { title: '布局' }
    }]
  },
  {
    path: '/404',
    component: () => import ('@/views/404.vue'),
    hidden: true
  },
  // 404 page must be placed at the end !!!
  { path: '*', redirect: '/404', hidden: true }
]

const router = new VueRouter({
  mode: 'history',
  routes: constantRoutes
})

export default router
